import React from 'react';
import ReactDOM from 'react-dom';

import { createHashHistory } from 'History';

import { Router, Route, useRouterHistory,IndexRedirect } from 'react-router'

import { syncHistoryWithStore, RouterStore } from 'mobx-react-router';

import { Provider } from 'mobx-react';
import Portal from './components/Portal'
import InteTabList from './components/InteTabList';
import Inte from 'weaInte'; //umd

const routing = new RouterStore();

const allStore = {
  routing,
  ...Inte.store,
}

const InteRoute = Inte.Route;

const browserHistory = useRouterHistory(createHashHistory)({
  queryKey: '_key',
  basename: '/'
});

const history = syncHistoryWithStore(browserHistory, allStore.routing);

const Home = props => props.children;

const Root = () => (
  <Provider ecId={`${this && this.props && this.props.ecId || ''}_Provider@hq20g5`} {...allStore}>
    <Router ecId={`${this && this.props && this.props.ecId || ''}_Router@57asbo`} history={history}>
      <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@alq0i0`} path="/main" component={Home}>
        { InteRoute }
      </Route>
      {/*随便起的，不知道业务*/}
      <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@ui697c`} path="/inte/portal/:eid/:tabId" component={Portal} />
      <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@j7jt1w`} path="/inte/tab/:showTypeId" component={InteTabList} />
    </Router>
  </Provider>
);


ReactDOM.render(<Root ecId={`${this && this.props && this.props.ecId || ''}_Root@uh76l4`}/>, document.getElementById('container'));
